package sjtu.ist.ecommerce.action;

import java.util.ArrayList;
import java.util.List;

import sjtu.ist.ecommerce.model.Order;
import sjtu.ist.ecommerce.service.OrderService;
import sjtu.ist.ecommerce.service.OrderServiceImpl;

import com.opensymphony.xwork2.ActionSupport;

public class OrderAction extends ActionSupport {
	private OrderService orderService=new OrderServiceImpl();

	//input
	private long id;
	
	//output
	private List<Order> orderList=new ArrayList<Order>();
	private Order order=null;
	
	public String getList() {
		// TODO Auto-generated method stub
		orderList=orderService.getList();
		return SUCCESS;
	}
	
	public String getById(){
		order=orderService.get(1);
		return SUCCESS;
	}
	
	public void setOrderService(OrderService orderService) {
		this.orderService = orderService;
	}

	public List<Order> getOrderList() {
		return orderList;
	}

	public Order getOrder() {
		return order;
	}
	
	public void setId(long id){
		this.id=id;
	}
}

/*
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:OrderSet xmlns:ns2="kruskal">
	<orderset>
		<orders>
			<goods>computer</goods>
			<id>1</id>
			<name>bill</name>
		</orders>
		<orders>
			<goods>table</goods>
			<id>2</id>
			<name>bob</name>
		</orders>
	</orderset>
</ns2:OrderSet>
*/